<extend name="Layout/ins_popup" />
<block name="content">
	<input type="hidden" name="ajax" id="ajax" value="1">
	<div class="popup-fixed">
		<div class="popup-header clearfix">
			<div class="pull-left">
				<h1>添加菜单</h1>
			</div>
			<div class="pull-right">
				<a onclick="save();" class="btn btn-sm btn-primary">确定</a>
				<a onclick="myclose();" class="btn btn-sm btn-default">关闭</a>
			</div>
		</div>
		<div class="popup-body" style="height: 420px;overflow-y: auto;">
			<form id="form_data" name="form_data" method="post" class="form-horizontal clearfix">
				<input type="hidden" name="ajax" id="ajax" value="1">
				<input type="hidden" name="opmode" id="opmode" value="add">
				<select name="node_list" id="node_list" class="hidden">
					{:fill_option($node_list)}
				</select>
				<div class="form-group col-xs-12">
					<label class="col-xs-3 control-label" for="name">名称*：</label>
					<div class="col-xs-9">
						<input class="form-control" type="text" id="name" name="name" check="require" msg="请输入名称">
					</div>
				</div>

				<div class="form-group col-xs-12">
					<label class="col-xs-3 control-label" for="url">地址：</label>
					<div class="col-xs-9">
						<input class="form-control" type="text" id="url" name="url">
					</div>
				</div>

				<div class="form-group col-xs-12">
					<label class="col-xs-3 control-label" for="url">父节点：</label>
					<div class="col-xs-9">
						<div class="input-group">
							<input name="node_name" class="form-control val" id="node_name" type="text"  readonly="readonly"/>
							<input name="pid"  id="pid" type="hidden" msg="请选择父节点" check="require"  />
							<span class="input-group-btn">
								<button class="btn btn-sm btn-primary" onclick="select_pid()" type="button">
									选择
								</button> </span>
						</div>
					</div>
				</div>
				<div class="form-group col-xs-12">
					<label class="col-xs-3 control-label" for="icon">图标：</label>
					<div class="col-xs-9">
						<input class="form-control" type="text" id="icon" name="icon" >
					</div>
				</div>
				<div class="form-group col-xs-12">
					<label class="col-xs-3 control-label" for="badge_function">统计函数：</label>
					<div class="col-xs-9">
						<input class="form-control" type="text" id="badge_function" name="badge_function" >
					</div>
				</div>
				<div class="form-group col-xs-12">
					<label class="col-xs-3 control-label" for="sort">排序：</label>
					<div class="col-xs-9">
						<input class="form-control" type="text" id="sort" name="sort" >
					</div>
				</div>

				<div class="form-group col-xs-12">
					<label class="col-xs-3 control-label" for="is_del">状态*：</label>
					<div class="col-xs-9">
						<select   name="is_del" id="is_del" class="form-control">
							<option  value="0">启用</option>
							<option value="1">禁用</option>
						</select>
					</div>
				</div>
			</form>
		</div>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		function select_pid() {
			winopen("{:U('winpop')}", 560, 470);
		}

		function save() {
			if (check_form("form_data")) {
				var vars = $("#form_data").serialize();
				sendAjax("{:U('save')}", vars, function(data) {
					if (data.status) {
						ui_alert(data.info, function() {
							parent.location.reload(true);
							myclose();
						});
					} else {
						ui_error(data.info);
					}
				});
			}
		}
	</script>

</block>